package com.qmerak.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qmerak.entity.OrgEntity;
import com.qmerak.service.IOrgService;

/**
 * @author shaohong.cheng
 * @date 2013-4-11
 */
@Controller
@RequestMapping("/org")
public class OrgAction {
	@Autowired
	private IOrgService orgService;

	@ResponseBody
	@RequestMapping(value = "add", method = RequestMethod.POST)
	public void addOrg(OrgEntity orgEntity) {
		orgService.add(orgEntity);
	}

	@ResponseBody
	@RequestMapping(value = "all", method = RequestMethod.GET)
	public List<OrgEntity> findAll() {
		return orgService.list();
	}

	@ResponseBody
	@RequestMapping(value = "update")
	public void update(OrgEntity entity) {
		orgService.update(entity);
	}

	@ResponseBody
	@RequestMapping(value = "delete", method = RequestMethod.POST)
	public void delete(OrgEntity entity) {
		orgService.delete(entity);
	}

}
